package com.baofu.paycore.service.factory.impl;

import com.baofu.paycore.manager.model.FreezeBO;
import com.baofu.paycore.service.facade.model.PayBaseDTO;
import com.baofu.paycore.service.factory.OrderFactory;
import com.baofu.paycore.service.factory.PayBaseFactory;
import com.baofu.paycore.service.processor.PayBaseProcessor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;

/**
 * 预授权单 组装工厂类
 *
 * <p>
 *  1.组装预授权模型
 * </p>
 * User: xin deng  Date: 16/8/30 ProjectName: paycore Version: 1.0
 */
@Slf4j
@Service
public class FreezeFactoryImpl extends PayBaseFactory implements OrderFactory {

    /**
     * 主单处理器
     */
    @Resource(name = "freezeProcessor")
    private PayBaseProcessor commonProcessor;


    @PostConstruct
    public void init(){
        processor.add(commonProcessor);
    }

    /**
     * 组装预授权模型
     *
     * @param payBaseDTO    请求对象
     * @return              支付模型
     */
    @Override
    public FreezeBO build(PayBaseDTO payBaseDTO) {
        FreezeBO freezeBO = new FreezeBO();
        super.buildBO(freezeBO,payBaseDTO);
        log.debug("冻结组装参数:{}", freezeBO);
        return freezeBO;
    }
}
